home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
sos3-2.lha
/
src
/
cci
/
sil_main.c
< prev
Wrap
C/C++ Source or Header
|
1992-01-23
|
3KB
|
125 lines
/* --------------------------------------------------------------------------
* Copyright 1992 by Forschungszentrum Informatik (FZI)
*
* You can use and distribute this software under the terms of the licence
* you should have received along with this program.
* If not or if you want additional information, write to
* Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
* D-7500 Karlsruhe 1, Germany.
* --------------------------------------------------------------------------
*/
// **************************************************************************
// Module sil_main Juergen Uhl (ju)
//
// **************************************************************************
// SOS schema implementation linker (sil)
// **************************************************************************
#include <stream.h>
#include "sys.h"
#include "smg.h"
#include "sos.h"
#include "trc.h"
#include "cci_err.h"
#include "cci_use.h"
int main (int argc, char *argv[])
{ T_INIT ("sil.out");
sos_init (argc, argv);
if (argc < 2)
{ err_raise (err_USE, err_SIL_USAGE, NULL, FALSE);
T_EXIT(); exit (1);
}
sos_String str = smg_String (argv[1]).make_String (TEMP_CONTAINER);
sos_Schema_module sm = sos_Schema_module::lookup (str);
str.destroy();
if (sm == NO_OBJECT)
{ err_raise (err_USE, err_SIL_NO_SCHEMA, argv[1], FALSE);
T_EXIT(); exit (1);
}
sos_Container sct = sm.container();
sct.open (WRITING, WAITING);
cci_Schema_impl impl = cci_Schema_impl::make_impl (sm);
sos_String_List ofs = impl.get_object_files(),
libs = impl.get_libraries(),
schemas = impl.get_schemas();
for (int i = 2; i < argc; i++)
{ if (streql (argv[i], "-r"))
{ ofs.clear();
libs.clear();
schemas.clear();
}
else if (streql (argv[i], "-a"))
{ str = sos_String::create (TEMP_CONTAINER);
smg_String tmp;
while (++i < argc)
{ int len = strlen (argv[i]);
char *arg = argv[i],
*tail2 = arg + len - 2;
sos_String_List list;
if (len > 2 AND streql (".o", tail2))
list = ofs;
else if (len > 2 AND (streql (".a", tail2)
OR arg[0] EQ '-' AND arg[1] EQ 'l'))
list = libs;
else if (len > 4 AND streql (".sos", tail2-2))
{ list = schemas;
arg = strncpy (new (char[len-3]), arg, len - 4);
arg[len-4] = EOS;
tmp = smg_String (arg, SMG_TRANSFER);
}
else
break;
str.assign_Cstring (arg);
if (NOT list.is_element (str))
list.append (sos_String::copy (str, sct));
}
-- i;
str.destroy();
}
else if (streql (argv[i], "-p"))
{ agg_iterate (ofs, str)
cout << str << "\n";
agg_iterate_end (ofs, str);
agg_iterate (libs, str)
cout << str << "\n";
agg_iterate_end (libs, str);
agg_iterate (schemas, str)
cout << str << ".sos\n";
agg_iterate_end (schemas, str);
}
else if (streql (argv[i], "-l"))
{ err_block
impl.load();
cout << "...done\n";
err_exception
cout << err_last_raised() << "\n";
T_EXIT(); exit (1);
err_block_end
}
else
{ err_raise (err_USE, err_SIL_USAGE, argv[i], FALSE);
T_EXIT(); exit (1);
}
}
sct.close ();
T_EXIT ();
exit (0);
}